import { Controller, Get, Post, Body, Param, Delete } from '@nestjs/common';
import { CollectService } from './collect.service';
import { CreateCollectDto } from './dto/create-collect.dto';
import { GetUserInfo, RequrieLogin } from 'src/cu-dec';

@Controller('collect')
@RequrieLogin()
export class CollectController {
  constructor(private readonly collectService: CollectService) {}

  @Post()
  create(
    @Body() createCollectDto: CreateCollectDto,
    @GetUserInfo('id') id: number,
  ) {
    return this.collectService.create(createCollectDto, id);
  }

  @Get()
  findAll(@GetUserInfo('id') id: number) {
    return this.collectService.findAll(+id);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.collectService.findOne(+id);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.collectService.remove(+id);
  }
}
